package com.trkj.controller;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.trkj.pojos.LmbAllotApplyDetalied;
import com.trkj.pojos.LmbConsumable;
import com.trkj.pojos.LmbConsumableCollar;
import com.trkj.pojos.LmbConsumableCollarDetail;
import com.trkj.pojos.LmbConsumableInvent;
import com.trkj.pojos.LmbConsumableInventDetail;
import com.trkj.pojos.LmbConsumableOutboundDetail;
import com.trkj.pojos.LmbCousumablePurchase;
import com.trkj.pojos.Tbdepartment;
import com.trkj.pojos.YzrStorehouse;
import com.trkj.pojos.YzrSupplier;
import com.trkj.service.HwcStaffService;
import com.trkj.service.LmbCkpdService;
import com.trkj.service.LmbCouPurYhService;
import com.trkj.service.LmbCouPurYlService;
import com.trkj.service.LmbCousumablePurchaseService;
import com.trkj.service.LmbHCService;
import com.trkj.service.LmbHcckService;
import com.trkj.service.LmbHcdbService;
import com.trkj.service.LmbHcsyService;
import com.trkj.service.LmbKcCunService;
import com.trkj.service.LmbMaterialStorageService;
import com.trkj.service.LmbOddNumbersService;
import com.trkj.vo.HcckVo;
import com.trkj.vo.LmbCkPdVo;
import com.trkj.vo.LmbCkVo;
import com.trkj.vo.LmbCouPurVo;
import com.trkj.vo.LmbCouYlVo;
import com.trkj.vo.LmbCousumablePurchaseVo;
import com.trkj.vo.LmbCurPlanVo;
import com.trkj.vo.LmbCurPurListVo;
import com.trkj.vo.LmbCurPurPlanVo;
import com.trkj.vo.LmbDbVo;
import com.trkj.vo.LmbHcYsVo;
import com.trkj.vo.LmbHcckVo;
import com.trkj.vo.LmbHcsyVo;
import com.trkj.vo.LmbHlVo;
import com.trkj.vo.LmbKcVo;
import com.trkj.vo.LmbMaterialStorageDetailVo;
import com.trkj.vo.LmbMaterialStorageVo;
import com.trkj.vo.LmbMetStorageVo;
import com.trkj.vo.LmbPurchaseDetailVo;
import com.trkj.vo.LmbStaffVo;
import com.trkj.vo.LmbhcdbVo;
import com.trkj.vo.Result;

@Controller
public class LmbController {
	@Autowired
	private LmbOddNumbersService lmboddNumbersService;
	@Autowired
	private LmbCouPurYhService LmbcouPurYhService;
	@Autowired
	private LmbMaterialStorageService lmbMaterialStorageService;
	@Autowired
	private LmbCouPurYlService lmbCouPurYlService;
	@Autowired
	private LmbCousumablePurchaseService couPurchaseService;	
	@Autowired
	private LmbHCService hcService;
	@Autowired
	private LmbCkpdService ckpdService;	
	@Autowired
	private LmbHcckService hcckService;	
	@Autowired
	private	HwcStaffService	staffService;
	@Autowired
	private LmbHcsyService hcsyService;
	@Autowired
	private LmbKcCunService kcuCunService;
	@Autowired
	private LmbHcdbService hcdbService;
	/**
	 * 登录测试
	 * @return
	 */
	@RequestMapping("/tolmbLogin")
	public String tolmbLoginTest(){
		return "lmbLogin";
	}
	
	/**
	 * 登录（控制器）
	 * @param account
	 * @param password
	 * @return
	 */
	@RequestMapping("/lmb_login")
	public ModelAndView loginTest(HttpSession session,@RequestParam String account,@RequestParam String password){
		boolean pd = staffService.findAccountByStaff(account, password);
		//long staffNo = staffService.staffAccountTOStaffNo(account);
		//PageContext pageContext = (PageContext) getJspContext();
		//获取Spring容器
		//ApplicationContext ac = RequestContextUtils.findWebApplicationContext((HttpServletRequest) pageContext.getRequest());
		
		ModelAndView mv = new ModelAndView();
		
		if(pd == true){
			long staffNo =Long.parseLong(account.substring(6));
			String staffName = staffService.findAccountBySName(account);
			session.setAttribute("account",account); 
			mv.addObject("staffAccount", account);
			mv.addObject("staffPassword", password);
			mv.addObject("staffName",staffName);
			mv.addObject("staffNo",staffNo);
			//return "hwc_loginresult";
			
			mv.setViewName("lmb_index");
			
		}else{
			
			//return "yzr_index";
			
			mv.setViewName("hwc_loginresult");
			
		}
		
		return mv;
	} 
	
	
	
	@RequestMapping("/to_lmb")
	public String toLmb(){	
		return "lmb";
	}
	
	@RequestMapping("/to_lmb_hcgl")
	public String toLmbHcgl(){	
		return "lmb_hcgl";
	}

	@RequestMapping("/to_lmb_addCousumable")
	public @ResponseBody Result addCousumable(LmbConsumable consumable){
		hcService.addCousumable(consumable);
		return new Result(true, "添加成功！");
	}
	
	@RequestMapping("/to_lmb_editCousumable")
	public @ResponseBody Result editCousumable(LmbConsumable consumable){
		System.out.println(consumable.getCId());
		hcService.editCousumable(consumable);
		return new Result(true, "修改成功！");
	}
	
	@RequestMapping("/to_lmb_findCousumableById")
	public @ResponseBody LmbConsumable findCousumableById(String cId){
		System.out.println(cId);
		return hcService.queryCousumableById(cId);
	}
	
	
	@RequestMapping("/to_lmb_findAllLmbConsumable")
	public @ResponseBody Map<String,Object> findAllLmbConsumable(int page,int rows){
		return hcService.queryAllLmbConsumable(page, rows);
	}
	
	@RequestMapping("/to_lmb_findLmbConsumableByCname")
	public @ResponseBody Map<String,Object> findLmbConsumableByCname(String cname,int page,int rows){
		return hcService.queryLmbConsumableByCname(cname, page, rows);
	}
	
	@RequestMapping("/to_lmb_hcj")
	public String toLmbHcj(){	
		return "lmb_hcj";
	}
	
	@RequestMapping("/to_lmb_queryStaff")
	public @ResponseBody List<LmbStaffVo> queryTbStaff(){
		System.out.println("该方法已被调用！");
		return lmboddNumbersService.findStaff();
	}
		
	@RequestMapping("/to_lmb_findSupplier")
	public @ResponseBody List<YzrSupplier> findSupplier(){
		return lmboddNumbersService.findSupplier();
	}
	
	@RequestMapping("/to_findConsumable")
	public @ResponseBody List<LmbConsumable> findConsumable(){
		return lmboddNumbersService.findConsumable();
	}
	
	@RequestMapping("/to_lmb_doPlan")
	public @ResponseBody void doPlan(LmbCurPlanVo curPlanVo){
		System.out.println(curPlanVo.getCoulPurlPlan().getCpPlanDate());
		lmboddNumbersService.doPlan(curPlanVo);
	}
		
	//编辑采购计划
	@RequestMapping("/to_lmb_editCouPurPlan")
	public @ResponseBody Result editCouPurPlan(String cpPlanId,String cpPlanTitle,BigDecimal cpPlanMakepeople,BigDecimal cpPlanApprovepeople,Date cpPlanDate,LmbCurPlanVo curPlanVo){
		lmboddNumbersService.editCouPurPlan(cpPlanId, cpPlanTitle, cpPlanMakepeople, cpPlanApprovepeople, cpPlanDate, curPlanVo);
		return new Result(true, "修改成功！");
	}
	
	@RequestMapping("/to_deleteCurPurPlans")
	public @ResponseBody Result deleteCurPurPlans(String[] list){
		lmboddNumbersService.deleteCurPurPlan(list);
		return new Result(true, "删除成功！");
	}
	
	@RequestMapping("/to_queryCurPurPlanByPage")
	public @ResponseBody Map<String, Object> queryCurPurPlanByPage(int page, int rows){
		System.out.println(page);
		System.out.println(rows);
		return lmboddNumbersService.queryCurPurPlanByPage(page, rows);
	}
	
	@RequestMapping("/to_queryCurPurPlan")
	public @ResponseBody LmbCurPurPlanVo queryCurPurPlan(String cpPlanId){
		System.out.println(cpPlanId);
		return lmboddNumbersService.queryCurPurPlan(cpPlanId);
	}

	@RequestMapping("/to_queryCurPurPlanDetailsByPage")
	public @ResponseBody Map<String,Object> queryCurPurPlanDetailsByPage(String cpPlanId,int page,int rows){
		System.out.println(cpPlanId);
		return lmboddNumbersService.queryCurPurPlanDetailsByPage(cpPlanId, page, rows);
	}
	
	@RequestMapping("/to_queryCurPurPlanByStatus")
	public @ResponseBody Map<String,Object> queryCurPurPlanByStatus(String status,int page,int rows){
		System.out.println(status);
		return lmboddNumbersService.queryCurPurPlanByStatus(status, page, rows);
	}
	
	@RequestMapping("/to_queryCurPurPlanByTitle")
	public @ResponseBody Map<String,Object> queryCurPurPlanByTitle(String shuxing,int page,int rows){
		System.out.println(shuxing);
		return lmboddNumbersService.queryCurPurPlanByTitle(shuxing, page, rows);
	}
	
	@RequestMapping("/to_queryCurpurByPurstatus")
	public @ResponseBody Map<String,Object> queryCurpurByPurstatus(String shuxing,int page,int rows){
		System.out.println(shuxing);
		return lmboddNumbersService.queryCurpurByPurstatus(shuxing, page, rows);
	}
	
	@RequestMapping("/to_queryByApprovepeopleYsp")
	public @ResponseBody Map<String,Object> queryByApprovepeopleYsp(BigDecimal spr,int page,int rows){
		return lmboddNumbersService.queryByApprovepeopleYsp(spr, page, rows);		
	}
	
	/*@RequestMapping("/to_editCouPurPlans")
	public @ResponseBody Result editCouPurPlans(LmbCurPlanVo curPlanVo){
		lmboddNumbersService.editCouPurPlan(curPlanVo);
		return new Result(true, "修改成功");
	}*/
	
	/*@RequestMapping("/to_queryCouPurPlans")
	public @ResponseBody LmbCurPlanVo queryCouPurPlans(String cpPlanId){
		System.out.println("id为"+cpPlanId);
		return lmboddNumbersService.queryCouPurPlans(cpPlanId);	
	}*/
		
	
	
	
	
	@RequestMapping("/to_lmb_hc")
	public String toLmbHc(){	
		return "lmb_hc";
	}
	
	@RequestMapping("/to_cg_findbytj")
	public @ResponseBody Map<String,Object> findBytj(int page,int rows){
		return couPurchaseService.findBytj(page, rows);		
	}
	
	@RequestMapping("/to_cg_findAllCouPur")
	public @ResponseBody List<LmbCousumablePurchaseVo> findAllCouPurs(){
		List<LmbCousumablePurchaseVo> list = couPurchaseService.findAllCouPur();
		return list;		
	}
	
	@RequestMapping("/to_lmb_findCouPurById")
	public @ResponseBody LmbCouPurVo findCouPurByCpId(String cpId){
		return couPurchaseService.findCouPurById(cpId);
	}

	@RequestMapping("/to_addCousumablePurchase")
	public @ResponseBody void addCousumablePurchase(LmbCurPurListVo curPurListVo){
		couPurchaseService.addCousumablePurchase(curPurListVo);
	}
	
	@RequestMapping("/to_lmb_findPurchaseDetailVo")
	public @ResponseBody List<LmbPurchaseDetailVo> findPurchaseDetailVo(String pdcpId){
		return couPurchaseService.findPurchaseDetailVo(pdcpId);
	}
	
	@RequestMapping("/to_lmb_findLmbCouPurVoByIf")
	public @ResponseBody Map<String,Object> findLmbCouPurVoByIf(String name,String shuxing,int page,int rows){
		return couPurchaseService.findLmbCouPurVoByIf(name, shuxing, page, rows);
	}
			
	@RequestMapping("/to_lmb_hcsp")
	public String toLmbhcsp(){	
		return "lmb_hspjh";
	}
	
	@RequestMapping("/to_lmb_sp_hccgjh")
	public @ResponseBody Result toLmbSpCouPurPlan(String id,String jg,String bz){	
		lmboddNumbersService.spCouPurPlan(id, jg, bz);
		return new Result(true, "审核成功！");
	}
	
	@RequestMapping("/to_hsp_findByApprovepeople")
	public @ResponseBody Map<String,Object> findqueryByApprovepeople(BigDecimal spr,int page,int rows){
		return lmboddNumbersService.queryByApprovepeople(spr, page, rows);		
	}
	
	@RequestMapping("/to_lmb_hcys")
	public String tolmb_hcys(){	
		return "lmb_hcys_two";
	}
	
	@RequestMapping("/to_lmb_findAllCouPurNoCheck")
	public @ResponseBody Map<String,Object> findAllCouPurNoCheck(int page,int rows){
		return LmbcouPurYhService.queryAllCouPurNoCheck(page, rows);		
	}
	
	@RequestMapping("/to_lmb_findPurDetByPdcpId")
	public @ResponseBody  Map<String,Object> findPurDetByPdcpId(String pdId,int page,int rows){
		return LmbcouPurYhService.queryAlLPurDetByPdcpId(pdId, page, rows);		
	}	
	
	@RequestMapping("/to_lmb_findAllCgCouPur")
	public @ResponseBody List<LmbCousumablePurchase> findAllCgCouPur(){
		return LmbcouPurYhService.queryAllCgCouPur();
	}

	@RequestMapping("/to_lmb_findByJCaiGouDate")
	public @ResponseBody Map<String, Object> findByJCaiGouDate(Date startDate,Date endDate,int page, int rows){
		return LmbcouPurYhService.queryByJCaiGouDate(startDate, endDate, page, rows);
	}
	
	@RequestMapping("/to_lmb_findCgCouPurByIf")
	public @ResponseBody Map<String, Object> findCgCouPurByIf(int page, int rows,String name,String value){
		return LmbcouPurYhService.queryByIf(page, rows, name, value);		
	}
	
	@RequestMapping("/to_lmb_submitCheckMed")
	public @ResponseBody Result submitCheckMed(LmbHcYsVo hcYsVo){		
		 LmbcouPurYhService.submitCheckMed(hcYsVo);
		 return new Result(true, "验收成功！");
	}
	
	@RequestMapping("/to_findAllCouPur")
	public @ResponseBody List<LmbCousumablePurchaseVo> findAllCouPur(){
		List<LmbCousumablePurchaseVo> list = LmbcouPurYhService.findAllCouPur();
		return list;		
	}

	@RequestMapping("to_findAllPurDetail")
	public @ResponseBody List<LmbPurchaseDetailVo> findAllPurDetail(String pid){
		System.out.println("已被调用");
		return LmbcouPurYhService.findAllPurDetail(pid);		
	}
	
	@RequestMapping("/to_editCurPurchase")
	public @ResponseBody Result editCurPurchase(String[] list1,String staffAccount,String result){
		System.out.println("账号为"+staffAccount);
		LmbcouPurYhService.editCousumablePurchase(list1,staffAccount,result);
		return new Result(true, "验收成功！");
	}
	
	@RequestMapping("/to_findCouPurchaseByStatus")
	public @ResponseBody List<LmbCousumablePurchaseVo> findCouPurchaseByStatus(String name,String value){
		List<LmbCousumablePurchaseVo> list = LmbcouPurYhService.findCouPurchaseBySearch(name, value);
		return list;		
	}
	
	@RequestMapping("/to_lmb_ht")
	public String toLmbHt(){	
		return "lmb_ht";
	}
	
	@RequestMapping("/to_findCouPurchaseByResult")
	public @ResponseBody List<LmbCousumablePurchaseVo> findCouPurchaseByResult(){
		List<LmbCousumablePurchaseVo> list = LmbcouPurYhService.findCouPurchaseByResult();
		return list;		
	}	
	
	@RequestMapping("/to_lmb_hr")
	public String toLmbHr(){	
		return "lmb_hr";
	}
	
	@RequestMapping("/to_findCouPurchaseByResults")
	public @ResponseBody List<LmbCousumablePurchaseVo> findCouPurchaseByResults(){
		List<LmbCousumablePurchaseVo> list = LmbcouPurYhService.findCouPurchaseByResult();
		return list;		
	}		
	
	@RequestMapping("/to_findPZDH")
	public @ResponseBody List<LmbPurchaseDetailVo> findPZDH(String n){
		System.out.println("n为："+n);
		return LmbcouPurYhService.findPZDH(n);		
	}	
	
	@RequestMapping("/to_lmb_findCkByKind")
	public @ResponseBody List<YzrStorehouse> findCkByKind(String kind){
		List<YzrStorehouse> list = LmbcouPurYhService.findCkByKind(kind);
		return list;		
	}
		
	@RequestMapping("/to_lmb_doHr")
	public @ResponseBody void doHr(LmbMaterialStorageVo matStorageVo){
		lmbMaterialStorageService.doHr(matStorageVo);;		
	}
	
	@RequestMapping("/to_queryMaterialStorage")
	public @ResponseBody LmbMetStorageVo queryMaterialStorage(String msId){
		return lmbMaterialStorageService.queryMaterialStorage(msId);		
	}
	
	@RequestMapping("/to_findMatStorDetailsByMsdMsId")
	public @ResponseBody List<LmbMaterialStorageDetailVo> findMatStorDetailsByMsdMsId(String msId){
		return lmbMaterialStorageService.findMatStorDetailsByMsdMsId(msId);		
	}
	
	@RequestMapping("/to_queryAllMaterialStorage")
	public @ResponseBody Map<String,Object> queryAllMaterialStorage(int page,int rows){
		System.out.println("已被调用111");
		Map<String,Object> map = lmbMaterialStorageService.queryAllMaterialStorage(page, rows);
		return map;
	}	
	
	@RequestMapping("/to_findMaterialStorageByDate")
	public @ResponseBody Map<String,Object> findMaterialStorageByDate(int page,int rows,Date ksrq,Date jsrq){
		System.out.println("已被调用!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
		Map<String,Object> map = lmbMaterialStorageService.findMaterialStorageByDate(page, rows, ksrq, jsrq);
		return map;
	}
	
	@RequestMapping("/to_findCouPurById")
	public @ResponseBody  LmbCousumablePurchase findCouPurById(String value){
		return lmbMaterialStorageService.findCouPurById(value);
	}
	
	@RequestMapping("/to_lmb_hl")
	public String toLmbHl(){	
		return "lmb_hl";
	}
	
	@RequestMapping("/to_queryLmbConsumableCollarByPage")
	public @ResponseBody Map<String, Object> queryLmbConsumableCollarByPage(int page, int rows){
		System.out.println(page);
		System.out.println(rows);
		return lmbCouPurYlService.queryLmbConsumableCollarByPage(page, rows);
	}	
	
	@RequestMapping("/to_lmb_queryAllDeptLmb_byPage")
	public @ResponseBody Map<String,Object> queryAllDeptLmbByPage(int page,int rows){
		return lmbCouPurYlService.queryAllDeptByPage(page, rows);
	}
		
	@RequestMapping("/to_lmb_queryAllDeptLmb")
	public @ResponseBody List<Tbdepartment> queryAllDeptLmb(){
		return lmbCouPurYlService.queryAllDept();
	}
	
	@RequestMapping("/to_lmb_findAllDeptBydname")
	public @ResponseBody  Map<String,Object> findAllDeptBydname(int page,int rows,String ksName){
		return lmbCouPurYlService.queryAllDeptBydname(page, rows, ksName);
	}
	
	@RequestMapping("/to_lmb_findStaffByIf")
	public @ResponseBody Map<String,Object> queryStaffByIf(int page,int rows,String value){
		return lmbCouPurYlService.queryStaffByIf(page, rows, value);
	}
	
	@RequestMapping("/to_lmb_hcly")
	public @ResponseBody Result hcly(LmbHlVo hlVo){
		lmbCouPurYlService.hcly(hlVo);
		return new Result(true, "领用申请成功！") ;	
	}
	
	@RequestMapping("/to_lmb_hclysp")
	public String hclysp(){
		return "lmb_hlshenpi";
	}
	
	@RequestMapping("/to_queryHclysp")
	public @ResponseBody Map<String, Object> queryHclysp(BigDecimal spr,int page, int rows){
		System.out.println(spr);
		return lmbCouPurYlService.queryHclysp(spr, page, rows);
	}	
	
	@RequestMapping("/to_queryHclyxq")
	public @ResponseBody List<LmbConsumableCollarDetail>  queryHclyxq(String collarId){
		return lmbCouPurYlService.queryHclyxq(collarId);
	}
	
	@RequestMapping("/to_queryHclyById")
	public @ResponseBody LmbConsumableCollar queryHclyById(String collarId){
		return lmbCouPurYlService.queryHclyById(collarId);
	}
	
	@RequestMapping("/to_hclyshenpi")
	public void hclyshenpi(String collarId,String jg,String bz){
		System.out.println("collarId为："+collarId);
		System.out.println("jg为："+jg);
		System.out.println("bz为："+bz);
		lmbCouPurYlService.hclysp(collarId, jg, bz);
	}
	
	@RequestMapping("/to_queryHclyYsp")
	public @ResponseBody Map<String, Object> queryHclyYsp(BigDecimal spr,int page, int rows){
		return lmbCouPurYlService.queryHclyYsp(spr,page, rows);
	}	
	
	@RequestMapping("/to_queryAllLy")
	public @ResponseBody List<LmbConsumableCollar> queryAllLy(){
		return lmbCouPurYlService.queryAllLy();
	}
	
	@RequestMapping("/toLmbHcpd")
	public String toLmbHcpd(){
		return "lmb_hcpd";
	}
	
	@RequestMapping("/to_HcByCkId")
	public @ResponseBody Map<String, Object> findHcByCkId(int page,int rows,String ckId){
		return ckpdService.findHcByCkId(page, rows, ckId);		
	}
	
	@RequestMapping("/to_findAllHcByCkId")
	public @ResponseBody List<LmbCkVo> findAllHcByCkId(String ckId){
		return ckpdService.findAllHcByCkId(ckId);		
	}
	
	@RequestMapping("/to_findAllHcByCname")
	public @ResponseBody Map<String, Object> findAllHcByCname(int page,int rows,String cName){
		return ckpdService.findAllBycname(page, rows, cName);		
	}
	
	@RequestMapping("/to_pdHcKc")
	public @ResponseBody Result pdHcKc(LmbCkPdVo ckPdVo){
		ckpdService.pdHcKc(ckPdVo);;
		return new Result(true, "盘点成功！") ;		
	}
		
	@RequestMapping("/toLmbHcck")
	public String toLmbHcck(){
		return "lmb_hcck";
	}
	
	@RequestMapping("/to_findAllYspwly")
	public @ResponseBody Map<String, Object> findAllYspwly(int page,int rows,String ckId){
		System.out.println("已被调用5555");
		return lmbCouPurYlService.queryAllYspwly(page, rows);
	}
	
	@RequestMapping("/to_findLyBylydh")
	public @ResponseBody LmbCouYlVo queryLyBylydh(String collarId){
		return lmbCouPurYlService.queryLyBylydh(collarId);		
	}
	
	@RequestMapping("/to_findLyxqByLyId")
	public @ResponseBody List<LmbKcVo> queryLyxqByLyId(String collarId){
		return lmbCouPurYlService.queryLyxqByLyId(collarId);		
	}
	
	@RequestMapping("/to_hcck")
	public @ResponseBody void hcck(LmbHcckVo hcckVo){
		hcckService.hcck(hcckVo);
	}
	@RequestMapping("/toLmbHcsy")
	public String toLmbHcsy(){
		return "lmb_hcsy";
	}
	
	@RequestMapping("/toLmbHcBaoSun")
	public @ResponseBody void pdHcBs(LmbHcsyVo hcsyVo){
		hcsyService.pdHcBs(hcsyVo);
	}
	
	@RequestMapping("/toLmbHckucun")
	public String hcKuCun(){
		return "lmb_hckucun";
	}
	
	@RequestMapping("/tofindAllKncunByPage")
	public @ResponseBody Map<String,Object> findAllKncunByPage(int page,int rows){
		return kcuCunService.queryAllKncunByPage(page, rows);		
	}
	
	@RequestMapping("/tofindAllKncun")
	public @ResponseBody List<LmbCkVo> findAllKncun(){
		return kcuCunService.queryAllKncun();
	}
	
	@RequestMapping("/tofindAllByckName")
	public @ResponseBody Map<String,Object> findAllByckName(int page,int rows,String shuxing){
		return kcuCunService.queryAllByckName(page, rows,shuxing);
	}
	
	@RequestMapping("/to_findAllkucunByCname")
	public @ResponseBody Map<String, Object> findAllkucunByCname(int page,int rows,String shuxing){
		return ckpdService.findAllBycname(page, rows, shuxing);		
	}
	
	@RequestMapping("/toLmbHcDiaobo")
	public String hcDiaobo(){
		return "lmb_hcdb";
	}
	
	@RequestMapping("/toLmbDoHcdb")
	public @ResponseBody void doHcdb(LmbhcdbVo hcdbVo){
		hcdbService.doHcdb(hcdbVo);
	}
	
	@RequestMapping("/toLmbfindDbByPage")
	public @ResponseBody Map<String,Object> findDbByPage(int page,int rows){
		return hcdbService.findDbByPage(page, rows);		
	}
	
	@RequestMapping("/toLmbfindAllDb")
	public @ResponseBody List<LmbDbVo> findAllDb(){
		return hcdbService.findAllDb();	
	}
	
	@RequestMapping("/toLmbfindXqBydbId")
	public @ResponseBody List<LmbAllotApplyDetalied> findXqBydbId(String id){
		return 	hcdbService.findXqBydbId(id);
	}
	
	@RequestMapping("/toLmbfindOneDb")
	public @ResponseBody  LmbDbVo findOneDb(String allotId){
		return hcdbService.findOneDb(allotId);
	}
	
	@RequestMapping("/toLmbqueryLyByLyId")
	public @ResponseBody List<LmbConsumableCollarDetail> queryLyByLyId(String collarId){
		System.out.println("领用详情");
		for(LmbConsumableCollarDetail consumableCollarDetail:lmbCouPurYlService.queryHclyxq(collarId)){
			System.out.println(consumableCollarDetail.getCdCId()+consumableCollarDetail.getCdCName()+consumableCollarDetail.getCdCollarId());
		}
		return 	lmbCouPurYlService.queryHclyxq(collarId);
	}
	
	@RequestMapping("/toLmbqueryCollar")
	public @ResponseBody LmbCouYlVo queryCollar(String collarId){
		return lmbCouPurYlService.queryCollar(collarId);
	}
	
	@RequestMapping("/toLmbfindAllck")
	public @ResponseBody Map<String,Object> findAllck(int page,int rows){
		return hcckService.findAllck(page, rows);
	}
	
	@RequestMapping("/toLmbfindCkByckId")
	public @ResponseBody HcckVo findCkByckId(String coId){
		System.err.println(coId);
		return hcckService.findCkByckId(coId);
	}
	
	@RequestMapping("/toLmbfindckxq")
	public @ResponseBody List<LmbConsumableOutboundDetail> findckxq(String coId){
		return hcckService.findckxq(coId);
	}
	
	@RequestMapping("/toLmbfindinventByPage")
	public @ResponseBody Map<String,Object> findinventByPage(int page,int rows){
		return ckpdService.findinventByPage(page, rows);
	}
	
	@RequestMapping("/toLmbfindOneInvent")
	public @ResponseBody LmbConsumableInvent findOneInvent(String ciId){
		return ckpdService.findOneInvent(ciId);
	}
	
	@RequestMapping("/toLmbfindInvenDet")
	public @ResponseBody List<LmbConsumableInventDetail> findInvenDet(String ciId){
		return ckpdService.findInvenDet(ciId);
	}
	
	@RequestMapping("/toLmbfindCkjlByID")
	public @ResponseBody  Map<String,Object> findCkByID(int page,int rows,String coId){
		return hcckService.findCkByID(page, rows, coId);		
	}
}
